# 如何学习使用模块
#  查资料
#  官网   博客  看书
import random
# random.random
# random.randint
# random.randrange
# random.seed
# random.choice
# random.choices
# random.shuffle



import random
# print(random.randint(2,5))


# seq = [2,3,4]
# print('srers')
# print(random.choice(seq))
#  在序列中随机一个元素


# shuffle   洗牌
# list1 = [x for x in range(1,10)]
# print(list1)
# random.shuffle(list1)
# print(list1)
# res = random.shuffle(list1)
# print(res)


#  返回随机浮点数( 0--1 )
# print(random.random())

# random. uniform( a,b )
#  返回 a ,b 之间浮点数,包括a ,b
# print(random.uniform(4,6))


# random.seed(a=None, version=2)
# random.choices(population, weights=None, *, cum_weights=None, k=1)
# random.sample(population, k)


# random.sample(population, k)
list1 = [1,2,3,6,9]
print(random.sample(list1,1))
# 随机 k个数 ,sample  无放回的取


# # random.choices(population, weights=None, *, cum_weights=None, k=1)
# list2 = [2,3,4]                                # 累加权重=[0.2---]
# print(random.choices(list2,weights=[0,0,1],k=1))  #  权重
#
# print(random.choices(list1,k = 2))
print('-------')    # 有放回的取






# # random.seed(a=None, version=2)
# random.seed(10)
# print(random.randint(1,100))
# random.seed(10)
# print(random.randint(5,100))
#
# print('------')
# random.seed(10)
# print(random.randint(1,100))
# random.seed(10)
# print(random.randint(5,100))



